using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Entities;
using BUS;
public partial class Admin_HinhThucTTEdit : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack )
        {
            load_data ();
        }
    }
    private void load_data()
    {
        try
        {
            int iD = int.Parse(Request.QueryString["id"].ToString());
            tbHinhThucTT  hinhthuctt = tbHinhThucTTBUS .GetById (iD);
            if (hinhthuctt != null)
            {
                txt_MaHT .Text =hinhthuctt .IdHinhThuc .ToString ();
                txt_TenHT .Text =hinhthuctt .TenHinhThuc .ToString ();
            }
        }
        catch
        {
            Response.Redirect("~/Admin/HinhThucTTList.aspx");
        }
    }
    protected void btn_Update_Click(object sender, EventArgs e)
    {
        try
        {
            tbHinhThucTT hinhthuctt = tbHinhThucTTBUS.GetById(int.Parse(txt_MaHT.Text));
            hinhthuctt.TenHinhThuc = txt_TenHT.Text;
            tbHinhThucTTBUS .Update (hinhthuctt);
            Response.Redirect("~/Admin/HinhThucTTList.aspx");
        }
        catch
        {
            Response.Redirect("~/Admin/HinhThucTTList.aspx");

        }
    }
}
